home *** CD-ROM | disk | FTP | other *** search
- Path: sed.psrw.com!psinntp!psinntp!psinntp!pipeline!not-for-mail
- From: johndill@nyc.pipeline.com (John Dillworth)
- Newsgroups: comp.lang.c
- Subject: Why does this trip over control codes (Win 3.1 SDK)
- Date: 11 Apr 1996 15:49:34 -0400
- Organization: Pipeline
- Message-ID: <4kjnoe$di2@pipe10.nyc.pipeline.com>
- NNTP-Posting-Host: pipe10.nyc.pipeline.com
- X-PipeUser: johndill
- X-PipeHub: nyc.pipeline.com
- X-PipeGCOS: (John Dillworth)
- X-Newsreader: Pipeline v3.5.0
-
- I'm trying to modify the poepoem.c program from Petzold to print source
- code instead of just text. The .rc file looks like this
-
- /*----------------------------
- POEPOEM.RC resource script
- ----------------------------*/
-
- #include "poepoem.h"
-
- poepoem ICON poepoem.ico
- AnnabelLee TEXT poepoem.asc
-
- STRINGTABLE
- {
- IDS_APPNAME, "poepoem"
- IDS_CAPTION, """Annabel Lee"" by Edgar Allen Poe"
- IDS_POEMRES, "AnnabelLee"
-
- The AnnabelLee TEXT poepoem.asc line points to an text file. It prints
- just fine. If I want the program to print source code it has a problem
- with the C control characters and stops printing when it hits one. The
- fragment from the >c file is
-
- LoadString (hInst, IDS_POEMRES, szPoemRes, sizeof szPoemRes) ;
- hResource = LoadResource (hInst,
- FindResource (hInst, szPoemRes, "TEXT")) ;
-
- lpText = LockResource (hResource) ;
-
- nNumLines = 0 ;
-
- while (*lpText != '\\' && *lpText != '\0')
- {
- if (*lpText == '\n')
- nNumLines ++ ;
- lpText = AnsiNext (lpText) ;
- }
- *lpText = '\0' ;
-
- GlobalUnlock (hResource) ;
-
- SetScrollRange (hScroll, SB_CTL, 0, nNumLines, FALSE) ;
- SetScrollPos (hScroll, SB_CTL, 0, FALSE) ;
- return 0 ;
-
-
- How can I make this program print source code?
-
-
- Thanks
-
- }
- --
-
- John Dillworth
-